/*
 * $HeadURL: $
 * $Id: $
 * Copyright (c) 2012 by Wodensoft System, all rights reserved.
 */
package com.wodensoft.platform.script;

import java.util.HashMap;
import java.util.Map;

import com.wodensoft.core.context.RequestContext;
import com.wodensoft.core.context.SessionContext;
import com.wodensoft.core.script.ScriptExecutionContext;

/**
 * @author Borball
 * 
 */
public class BasicScriptExecutionContext implements ScriptExecutionContext {

    private Map<String, Object> variables;

    public BasicScriptExecutionContext(Map<String, Object> extra) {
        variables = new HashMap<String, Object>();

        variables.put("request", RequestContext.getCurrent());

        variables.put("session", SessionContext.getCurrent());

        variables.putAll(extra);

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.wodensoft.util.el.ExecutionContext#getVariableContext()
     */
    @Override
    public Map<String, Object> getVariableContext() {
        return variables;
    }

}
